export default function fibDpComp(n: number): number {
  if (n <= 1) return n;

  let prev = 0;
  let cur = 1;
  for (let i = 2; i <= n; i++) {
    const newValue = prev + cur;
    prev = cur;
    cur = newValue;
  }

  return cur;
}

console.log(fibDpComp(10));
